<table id="dataTable"></table>

{include file="system@block/layui" /}

<script type="text/html" id="actionTpl">
    {{# if(d.ct == 1){ }}
    	{{# if(d.type == 1){ }}
			<span class="green">来料</span>
		{{# }else if(d.type == 2){ }}
			<span class="red">删除</span>
		{{# } }}
    {{# }else if(d.ct == 2){ }}
		{{# if(d.type == 1){ }}
			<span class="yellow">退料发起</span>
		{{# }else if(d.type == 2){ }}
			<span class="blue">退料入库</span>
		{{# }else if(d.type == 3){ }}
			<span class="cyan">退料确认</span>
		{{# }else if(d.type == 4){ }}
			<span class="mcolor">换料确认</span>
		{{# }else if(d.type == 5){ }}
			<span class="black">退换料审核</span>
		{{# } }}
    {{# } }}
</script>

<script type="text/html" id="createTimeTpl">
    <div>{{layui.util.toDateString(d.time * 1000) }}</div>
</script>

<script type="text/javascript">
    layui.use(['table', 'tool'], function() {
        var table = layui.table;
        table.render({
            elem: '#dataTable'
            ,url: "{:url('', ['mid'=>$mid])}" //数据接口
            ,page: true //开启分页
            ,skin: 'row'
            ,even: true
            ,limit: 20
            ,limits: [20,50,100,150,200]
            ,text: {
                none : '暂无相关数据'
            }
            ,toolbar: false
            ,defaultToolbar: ['filter', 'exports', 'print']
            ,cols: [[ //表头
                {field: 'action', title: '操作',templet: '#actionTpl', width:100}
                ,{field: 'tiaoshu', title: '条数'}
                ,{field: 'cloth_num', title: '布号',templet:function(d){return (d.cloth_num != '' && d.cloth_num != '0') ? d.cloth_num : ''; }}
                ,{field: 'create_time', title: '操作时间',templet: '#createTimeTpl', width:160}
            ]]
        });
    });
</script>